package filter;

import java.util.*;

public class XYSwapFilter extends Filter<Double, List<Double>>
{
    private Map<Object, List<Object>> myReturnMap = new HashMap<Object, List<Object>>();

    public XYSwapFilter()
    {
        super("XYSwap");
    }

    public List<String> getPrompts()
    {
        return new ArrayList<String>();
    }

    public Map<Object, List<Object>> filterData(
            Map<Object, List<Object>> inputData)
    {
        for (Object i : inputData.keySet())
        {
            double slightAdjust = 0;
            List<Object> newYValues = new ArrayList<Object>();
            newYValues.add(i);
            while (myReturnMap.containsKey((Double) inputData.get(i).get(0)
                    + slightAdjust))
                slightAdjust += 0.0001;
            myReturnMap.put((Double) inputData.get(i).get(0) + slightAdjust,
                    newYValues);
        }
        return myReturnMap;
    }

    public String toString()
    {
        return "Swap X and Y values";
    }

}
